package com.itheima.a01.测试组件;

import com.itheima.a01.事件的父类.UserRegisteredEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/*
 * 像容器里面放入Component2
 * */
@Component
public class Component2 {

    private static final Logger log = LoggerFactory.getLogger(Component2.class);

    /*这个是一个监听器，去监听事件的发生*/
    @EventListener
    public void aaa(UserRegisteredEvent event) {
        /*收到事件后我就打印这个事件*/
        log.debug("{}","我收到这个事件了~,我会发送短信");
        log.debug("发送短信~");
    }

}
